import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { BaseEntity } from "./base.entity";

@Entity()
export class Node extends BaseEntity {

    @PrimaryGeneratedColumn()
    id: number;

    @ManyToOne(type => Node, node => node.childIds)
    pid: number;

    @OneToMany(type => Node, node => node.pid)
    childIds: number;

    @Column({
        type: "char",
        length: 255,
    })
    name: string;
}
